<template>
    <div class="container">
        <div class="title"><span></span>公众号信息</div>
        <el-form class="zw-el-form" ref="formRef" :rules="rules" :model="form" label-width="110px">
            <el-form-item label="公众号APPID" prop="appid">
                <el-input maxlength="20" placeholder="请输入公众号ID" v-model.trim="form.appid"></el-input>
            </el-form-item>
            <div class="tip">
                <span>提示：公众号APPID的查询路径如下</span>
                <span>登录https://mp.weixin.qq.com/ -- 基本配置 -- 公众号开发信息 -- 开发者ID（APPID)</span>
            </div>
            <div class="btnWrapper">
                <el-button class="submit" type="primary" @click="submitHandler">提交申请</el-button>
                <el-button class="cancel" type="default" plain @click="cancelHandler">取消</el-button>
            </div>
        </el-form>
    </div>
</template>
<script setup>
import { ref, reactive } from 'vue';
const emit = defineEmits(['submit', 'cancel']);
const formRef = ref(null);
const form = reactive({
    // 公众号APPID
    appid: ''
});
const rules = reactive({
    appid: [{ required: true, message: '请输入公众号ID', trigger: 'blur' }]
});
const submitHandler = () => {
    formRef.value.validate(valid => {
        if (valid) {
            emit('submit');
        }
    });
};
const cancelHandler = () => {
    emit('cancel');
};
</script>
<style lang="scss" scoped>
.container {
    padding-top: 16px;
    :deep(.el-input--large) {
        width: 440px;
    }
    :deep(.el-form-item--large) {
        margin-bottom: 24px;
    }
    .title {
        display: flex;
        align-items: center;
        font-size: 16px;
        font-weight: 700;
        color: #33302d;
        line-height: 18px;
        margin-bottom: 24px;
        span {
            width: 4px;
            height: 16px;
            background: #ff6b00;
            margin-right: 8px;
        }
    }
}
.tip {
    display: flex;
    flex-direction: column;
    padding: 16px;
    width: 592px;
    height: 72px;
    background: #fffaf9;
    border-radius: 2px;
    box-sizing: border-box;
    margin-bottom: 30px;
    span {
        font-size: 14px;
        font-weight: 400;
        color: #ff6b00;
        line-height: 20px;
    }
}
.btnWrapper {
    display: flex;
    padding-top: 12px;
    .submit {
        width: 88px;
        margin-right: 12px;
    }
    .cancel {
        width: 80px;
    }
}
</style>
